<?php

use App\Config\Bootstrap;

date_default_timezone_set('Etc/GMT-8');
define('DS', DIRECTORY_SEPARATOR);
define('BASE_PATH', realpath(dirname(__FILE__) . '/../'));
define('APP_PATH', BASE_PATH . '/App/');

$envConfig = parse_ini_file(BASE_PATH . '/.env', true);
define('ENVIRONMENT', $envConfig['ENVIRONMENT']);
if(defined('ENVIRONMENT')) {
    switch((ENVIRONMENT)) {
        case 'development':
            error_reporting(E_ALL);
            ini_set('display_errors', 'On');
            break;
        case  'testing':
            error_reporting(E_ALL);
            ini_set('display_errors', 'On');
            break;
        case 'production':
        default:
            error_reporting(0);
            ini_set('display_errors', 'Off');
            break;
    }
}
try {
    include APP_PATH . 'Config/Bootstrap.php';
    $bootstrap = new Bootstrap($envConfig);
    $bootstrap->start();
} catch(\Exception $ex) {
    echo $ex->getMessage();
}